//let data = './data.json'
import data from "./data.json"
let regionData = []
  let TextToCode = {}
  let CodeToText = {}
  let provinceObj = data[86]
  for (let item in provinceObj){    //数据组合
    let province = {
      children: [],
      label: provinceObj[item],
      value: item,
    }
    TextToCode[province.label] = {code:item}
    CodeToText[item] = province.label
    let cityObj = data[item]
    for (let item2 in cityObj){
      let city = {
        children: [],
        label: cityObj[item2],
        value: item2,
      }
      TextToCode[province.label][city.label] = {code:item2}
      CodeToText[item2] = city.label
      let areaObj = data[item2]
      for (let item3 in areaObj){
        let area = {
          label: areaObj[item3],
          value: item3,
        }
        TextToCode[province.label][city.label][area.label] = {code:item3}
        CodeToText[item3] = area.label
        city.children.push(area)
      }
      province.children.push(city)
    }
    regionData.push(province)
  }
export {regionData,TextToCode,CodeToText}
